package com.amethyst.mybatisplus.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 用于演示高级功能(逻辑删除、自动填充、乐观锁插件、多租户SQL解析器)
 *
 * @author Amethyst
 * @date 2021/11/5
 */
@Data
@Accessors(chain = true)
public class UserAdvance {
    private Long id;
    private String name;
    private Integer age;
    private String email;
    private Long managerId;
    @TableField(fill = FieldFill.INSERT) // 插入时自动填充
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.UPDATE) // 更新时自动填充
    private LocalDateTime updateTime;
    /**
     * @Version 乐观锁注解，version值的类型只支持int，long，Data，Timestamp，LocalDateTime
     * 注意：如果使用 wrapper，则 wrapper不能复用。见例 testVersionMapper()
     */
    @Version
    private Integer version;
//    @TableLogic(value = "0", delval = "1") // 局部配置逻辑删除
    private Integer deleted;
}
